from curl_cffi import requests

total = 0
page = 1
while True:

    print(f"正在爬取第{page}页")
    url = f"https://mashangpa.com/api/problem-detail/2/data/?page={page}"

    headers = {
        'cookie': 'sessionid=knisj2ex95xlec3gp1rwa8zg5sfpd0wk',
        'referer': f'https://mashangpa.com/problem-detail/{page}/',
        'user-agent': 'Mozilla / 5.0(Windows NT 10.0;Win64;x64) AppleWebKit / 537.36(KHTML,like Gecko) Chrome / 141.0.0.0 Safari / 537.36'

    }

    content = requests.get(url, headers=headers)
    print(content.json())

    items = content.json()['current_array']
    for e in items:
        print(e)
        total += e
    if content.json()['pagination']['has_next']:
        page += 1
    else:
        break

print(f"总数：{total}")













































































